import service from '../utils/request'

//一个请求封装成一个函数
// 登录
export function user_login( payload = {} ){
    return service.post('/user/login', payload )
}
// 注册
export function user_register( payload = {} ){
    return service.post('/user/register', payload )
}
// 轮播图
export function index_banner( payload = {} ){
    return service.get('index/banner', { params: payload } )
}
//首页分类列表
export function index_nav( payload = {} ){
    return service.get('index/nav', { params: payload } )
}

// 首页商品列表
export function index_prolist(payload = {}) {
    return service.get('/index/goodlist',{params:payload})
}

// 一级分类
export function category_list( payload = {} ){
    return service.get('/category/list', { params: payload } )
}
// 二三级分类
export function category_subcate( payload = {} ){
    return service.get('/category/subcate', { params: payload } )
}

//所有商品
export function good_list(payload = {}) {
    return service.get('/good/list',{params:payload})
}

// 商品详情
export function goodinfo( payload = {} ){
    return service.get('/good/goodinfo', { params: payload } )
}

// 热门搜索
export function hotSearch( payload = {} ){
    return service.get('/good/hotsearch', { params: payload } )
}

//关键词搜索
export function keySearch( payload = {} ){
    return service.get('/good/search', { params: payload } )
}

//收藏列表
export function good_favlist(payload){
    return service.get('/good/favlist',{params:payload})
}

//收藏
export function good_fav(payload){
    return service.post('/good/fav',payload)
}

//取消收藏
export function good_unfav(payload){
    return service.post('/good/unfav',payload)
}

//购物车列表
export function shopcart_list(payload){
    return service.get('/shopcart/list',{params:payload})
}

//购物车清空
export function shopcart_clear(payload){
    return service.post('/shopcart/clear',payload)
}

//购物车数量加1
export function shopcart_add(payload){
    return service.post('/shopcart/add',payload)
}

//购物车数量减1
export function shopcart_sub(payload){
    return service.post('/shopcart/sub',payload)
}